import request from '@/axios';
import {baseUrl} from '@/config/env';


export const pageActTask = (data) => {
    return request({
            url: baseUrl + '/start/actTask/pageActTask',
            method: 'get',
            params: data
        }
    )
}
/**
 * list查询候选人
 * @returns {AxiosPromise}
 * @param taskId
 */
export const listTaskCandidateUser = (taskId) => {
    return request({
            url: baseUrl + '/start/actTask/listTaskCandidateUser/' + taskId,
            method: 'get',
        }
    )
}

/**
 * 添加任务候选人
 * @returns {AxiosPromise}
 * @param taskId
 * @param data
 */
export const addTaskCandidateUser = (taskId, data = {}) => {
    return request({
            url: baseUrl + '/start/actTask/addTaskCandidateUser/' + taskId,
            method: 'post',
            data: data
        }
    )
}
/**
 * 添加任务候选人
 * @param taskId
 * @param data
 * @returns {AxiosPromise}
 */
export const delTaskCandidateUser = (taskId, data) => {
    return request({
            url: baseUrl + '/start/actTask/delTaskCandidateUser/' + taskId,
            method: 'delete',
            data: data
        }
    )
}
/**
 * 获取运行时任务信息
 * @param taskId
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export const getRunTaskDetailByTaskId = (taskId) => {
    return request({
            url: baseUrl + '/start/actTask/getRunTaskDetailByTaskId/' + taskId,
            method: 'get',
        }
    )
}
/**
 * 修改运行时任务
 * @param data
 * @returns {*}
 */
export const updateRunTask = (data) => {
    return request({
            url: baseUrl + '/start/actTask/updateRunTask',
            method: 'post',
            data: data
        }
    )
}


const actTaskApi = {
    pageActTask,
    listTaskCandidateUser,
    addTaskCandidateUser,
    delTaskCandidateUser,
    getRunTaskDetailByTaskId,
    updateRunTask

}
export default actTaskApi
